package com.linrui.gift.client;

import com.linrui.gift.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class TenantFallbackFactory implements FallbackFactory<TenantClient> {

    @Override
    public TenantClient create(Throwable throwable) {
        return new TenantClient() {
            @Override
            public AjaxResult get(Long id) {
                log.error("查询失败"+throwable.getMessage());
                return AjaxResult.me().setSuccess(false).setMessage("店铺查询失败");
            }
        };
    }
}
